package com.corpgovernment.common.base;

/**
 * 基本处理程序
 */
public abstract class BaseProcessor<TRequest extends BaseRequestVO, TData> {

	/**
	 * 处理程序
	 */
	public JSONResult<TData> process(TRequest request) {
		this.init(request);
		this.validate(request);
		return this.processing(request);
	}

	/**
	 * 初始化
	 */
	protected void init(TRequest request) {
	}

	/**
	 * 参数验证
	 */
	protected abstract void validate(TRequest request);

	/**
	 * 处理
	 */
	protected abstract JSONResult<TData> processing(TRequest request);
}